using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Routing;
using ByHand.Services.Implements;
using ByHand.Services.Interfaces;
using Ninject;
using Ninject.Web.Common;
using ByHand.Data.Interfaces;
using ByHand.Data;

namespace FrontEnd
{
    // Note: For instructions on enabling IIS6 or IIS7 classic mode, 
    // visit http://go.microsoft.com/?LinkId=9394801
    public class MvcApplication : NinjectHttpApplication
    {
        protected override IKernel CreateKernel()
        {                                            
            var kernel = new StandardKernel();
            kernel.Load(Assembly.GetExecutingAssembly());
            kernel.Bind<ILogService>().To<LogService>();
            kernel.Bind<IGuuAttributeProductService>().To<GuuAttributeProductService>();
            kernel.Bind<ISmsLogService>().To<SmsLogService>();
            kernel.Bind<IOrderDetailService>().To<OrderDetailService>();
            kernel.Bind<IUserService>().To<UserService>();
            kernel.Bind<IProductOptionService>().To<ProductOptionService>();
            kernel.Bind<IOrderLogService>().To<OrderLogService>();
            kernel.Bind<IOrderService>().To<OrderService>();
            kernel.Bind<IProviderService>().To<ProviderService>();
            kernel.Bind<IProductService>().To<ProductService>();
            kernel.Bind<IDatabaseFactory>().To<DatabaseFactory>();
            kernel.Bind<IDisposable>().To<Disposable>();
            return kernel;
        }
        protected override void OnApplicationStarted()
        {
            base.OnApplicationStarted();
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            //BundleConfig.RegisterBundles(BundleTable.Bundles);
        }
    }

}